package MyIODemo;


import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;

public class WriterDemo {
    public static void main(String[] args) throws IOException {

//       打开文件
        Writer writer = new FileWriter("demo1.txt",true);

        Scanner in = new Scanner(System.in);
        String  buffer = in.nextLine();

//        写文件
        writer.write(buffer);


//        关闭文件
        writer.close();

    }
}
